From 698488ddc411c038d4aa8f44986bf60a985bda93 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 31 Oct 2013 12:18:59 -0400 Subject: [PATCH] gtkbox: Draw backgrounds and borders --- gtk/gtkbox.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index ea02a1492c..cb2539954e 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -149,6 +149,8 @@ struct _GtkBoxChild static void gtk_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); +static gboolean gtk_box_draw (GtkWidget *widget, + cairo_t *cr); static void gtk_box_direction_changed (GtkWidget *widget, GtkTextDirection previous_direction); @@ -221,6 +223,7 @@ gtk_box_class_init (GtkBoxClass *class) object_class->set_property = gtk_box_set_property; object_class->get_property = gtk_box_get_property; + widget_class->draw = gtk_box_draw; widget_class->size_allocate = gtk_box_size_allocate; widget_class->get_preferred_width = gtk_box_get_preferred_width; widget_class->get_preferred_height = gtk_box_get_preferred_height; @@ -416,6 +419,21 @@ gtk_box_get_property (GObject *object, } } +static gboolean +gtk_box_draw (GtkWidget *widget, + cairo_t *cr) +{ + GtkStyleContext *context; + GtkAllocation alloc; + + context = gtk_widget_get_style_context (widget); + gtk_widget_get_allocation (widget, &alloc); + + gtk_render_background (context, cr, 0, 0, alloc.width, alloc.height); + gtk_render_frame (context, cr, 0, 0, alloc.width, alloc.height); + + return GTK_WIDGET_CLASS (gtk_box_parent_class)->draw (widget, cr); +} static void count_expand_children (GtkBox *box, -- 2.30.2